<?php print form(null,null,array('enctype'=>'multipart/form-data','confirm'=>'Are you sure you want to upload a new slider image? It must be 920x330 pixels.'));?>
<h3>New item</h3>
<table class="x">
	<tr>
		<td>
			<b>Image</b><br/>
			<span class="small">Upload an image</span>
		</td>
		<td>
			<?php print input('file','image','Upload an image');?>
		</td>
	</tr>
	<tr>
		<td>
			<b>Description</b><br/>
			<span class="small">The text as it should appear on the front page</span>
		</td>
		<td>
			<?php 
				print textarea('','desc',array('rows'=>5,'style'=>'resize:none;'));
			?>
		</td>
	</tr>
	<tr>
		<td>
			<b>Order</b><br/>
			<span class="small">Set the slide position</span>
		</td>
		<td>
			<?php 
				$alt = array(); for ($i=-50;$i<=50;$i++) $alt[$i] = $i;
				print select($alt,0,'weight');
			?>
		</td>
	</tr>
</table>
<?php print submit('Upload',false,array('key'=>'u')).form(true);?>

<h3>Slider effects</h3>
<?php print formx();?>
<table class="x">
  <tr>
    <td><b>Effects</b><br/><span class="small">Select the effects you want to use with your <a href="http://nivo.dev7studios.com" target="_blank">Nivo Slider</a></span></td>
    <td>
    <?php
    	foreach (
    		array(
			'sliceDown',
			'sliceDownLeft',
			'sliceUp',
			'sliceUpLeft',
			'sliceUpDown',
			'sliceUpDownLeft',
			'fold',
			'fade',
			'slideInRight',
			'slideInLeft',
			'boxRandom',
			'boxRain',
			'boxRainReverse',
			'boxRainGrow',
			'boxRainGrowReverse'
		) AS $effect)
		{
			print input('checkbox','effect['.$effect.']',$effect,(in_array($effect, $this->v('effects'))?array('checked'=>'checked'):'')).' '.ucfirst($effect).'<br/>';
		}
    ?>
    </td>
  </tr>
</table>

<?php 
	print submit('Save effects',null,array('key'=>'e')).form(true);
?>

<?php if(null !== $this->v('images') && count($this->v('images'))>0):print formx();?>
<h3>Slider</h3>
<table class="x">
  <tr>
    <th>Image</th>
    <th>Description</th>
  </tr>
  <?php foreach ($this->v('images') AS $img):?>
  <tr>
    <td style="text-align:center;">
    	<a rel="lightbox" href="<?php print $img['full'];?>">
    		<img src="<?php print $img['thumb']; ?>"/>
    	</a><br/>
    	Delete? <input type="checkbox" name="delete-<?php print $img['id'];?>"/>
    	Order: 
       	<?php
    		// The weight
	    	$alt = array(); for ($i=-50;$i<=50;$i++) $alt[$i] = $i;
			print select($alt,$img['weight'],'weight-'.$img['id']);
    	?><br/>
    	
    </td>
  	<td>
  		<?php 
	    	// The description
	    	print editor($img['desc'],'desc-'.$img['id'],array('tinymce'=>true,'rows'=>5));
		?>
  	</td>
  </tr>
  <?php endforeach;?>
</table>
<?php print submit('Update',false,array('key'=>'s')).form(true);endif;?>